<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

</head>


<body>
    <ul>
        <li>li标签 11</li>
        <li>li标签 22</li>
        <li>li标签 33</li>
        <li>li标签 44</li>
    </ul>
</body>
<script>

    // 需要获取到的式一个伪数组  所以用getElementsByTagName
    var lis = document.getElementsByTagName('li');

    for (var i = 0; i < lis.length; i++) {

        lis[i].onclick = function () {
            // 显示当前点击的li标签内容
            alert(this.innerText)
        }
    }








</script>

</html>